package headfirst.combined.djview;

import static org.junit.Assert.*;

import org.junit.Test;

public class RPMModelTest {
	Motor motor = Motor.getInstance();
	RPMModel rpmModel = new RPMModel();
	int rpm1, rpm2;
	
	@Test
	public void testInitialize() {
		rpmModel.initialize();
		assertEquals("",1000,motor.get_rpm());
	}
	
	@Test
	public void testOn() {
		rpmModel.initialize();
		rpmModel.on();
		assertEquals("",1000,motor.get_rpm());
	}
	
	@Test
	public void testOff() {
		rpmModel.initialize();
		rpmModel.off();
		assertEquals("",0,motor.get_rpm());
	}
	
	@Test
	public void testAcelerar() {
		rpmModel.initialize();
		rpm1 = motor.get_rpm();
		rpmModel.acelerar();
		rpm2 = motor.get_rpm();
		assertTrue("",rpm1<rpm2);
	}
	
	@Test
	public void testDesacelerar() {
		rpmModel.initialize();
		rpm1 = motor.get_rpm();
		rpmModel.desacelerar();
		rpm2 = motor.get_rpm();
		assertTrue("",rpm1>rpm2);
	}
	
	@Test
	public void testPruebaMotor1() {
		rpmModel.initialize();
		assertTrue("",rpmModel.pruebaMotor1());
	}
	
	@Test
	public void testPruebaMotor2() {
		rpmModel.initialize();
		assertTrue("",rpmModel.pruebaMotor2());
	}
	
}
